package com.cyberfans.shop.service.product.impl;

import java.util.Arrays;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.cyberfans.shop.dao.impl.DaoSupport;
import com.cyberfans.shop.service.product.ProductTypeService;

@Service("productTypeService")
@Transactional
public class ProductTypeServiceImpl extends DaoSupport implements ProductTypeService {

	/* (non-Javadoc)
	 * @see com.cyberfans.shop.dao.impl.DaoSupport#delete(java.lang.Class, java.lang.Object[])
	 */
	@Override
	public <T> void delete(Class<T> entityClass, Object[] entityIds) {
		em.createQuery("update ProductType o set o.visable=:visable where o.typeId in (:entityIds)")
				.setParameter("visable", false)
				.setParameter("entityIds", Arrays.asList(entityIds))
				.executeUpdate();
	}
}
